<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message"/>
    
   <h:form id="cabineSearch" styleClass="edit">
	
		<h:panelGrid columns="3">
				<h:outputText value="consultar" styleClass="tituloPagina" />
				|
				<h:commandLink  value="Novo Cruzeiro" action="/cruzeiro.xhtml" />
			</h:panelGrid><br/>
			<rich:panel>
				<h:panelGrid columns="4" width="800">
				<h:column>
					<h:outputLabel value="Nome" /><br/>			
					<h:inputText value="#{cruzeiroList.cruzeiro.nome}" />
				</h:column>
				
				<h:column>
					<h:outputLabel value="Saida" /><br/>
					<a4j:outputPanel id="calendarioSaida" layout="block">			
					<rich:calendar value="#{cruzeiroList.cruzeiro.saida}" 
                    	popup="true"
                        datePattern="dd/MM/yyy hh:mm"
                        showApplyButton="false" cellWidth="24px" cellHeight="22px" style="width:200px"/>
                        </a4j:outputPanel>
				</h:column>
				
				<h:column>
					<h:outputLabel value="Chegada" /><br/>			
					<a4j:outputPanel id="calendarioChegada" layout="block">
					<rich:calendar value="#{cruzeiroList.cruzeiro.chegada}" 
                    	popup="true"
                        datePattern="dd/MM/yyy hh:mm"
                        showApplyButton="false" cellWidth="24px" cellHeight="22px" style="width:200px"/>
                       </a4j:outputPanel>
				</h:column>
				
				<h:column>
					<h:outputLabel value="Navio" for="navio" /><br/>
					<h:selectOneMenu value="#{cruzeiroList.cruzeiro.navio}">
						<s:selectItems noSelectionLabel="Selecione.." value="#{navioList.resultList}" var="navio_" label="#{navio_.nome}">
							</s:selectItems>
						<s:convertEntity />
					</h:selectOneMenu>
				</h:column>
				</h:panelGrid>
			</rich:panel>
			<rich:spacer height="5px" />
			<h:panelGrid columns="3">
				<h:commandButton value="Consultar" id="consultar" />
				|
				<h:commandLink  value="Limpar" />
			</h:panelGrid><br/>
			
			<rich:dataTable id="cruzeiroList" var="cruzeiro"
				value="#{cruzeiroList.resultList}" rows="10"
				rendered="#{not empty cruzeiroList.resultList}">
				<rich:column>
					<f:facet name="header">Nome</f:facet>
					<s:link id="nome" value="#{cruzeiro.nome}" view="/cruzeiro.xhtml">
						<f:param name="cruzeiroId" value="#{cruzeiro.id}" />
					</s:link>
				</rich:column>
				<rich:column>
					<f:facet name="header">Saida</f:facet> 
					<s:link id="saida" value=" #{cruzeiro.saida}" view="/cruzeiro.xhtml">
						<f:param name="cruzeiroId" value="#{cruzeiro.id}" />
					</s:link>                                    
                </rich:column>
                <rich:column>
					<f:facet name="header">Chegada</f:facet> 
					<s:link id="chegada" value=" #{cruzeiro.chegada}" view="/cruzeiro.xhtml">
						<f:param name="cruzeiroId" value="#{cruzeiro.id}" />
					</s:link>                                    
                </rich:column>
				<rich:column>
					<f:facet name="header">Navio</f:facet>
					<s:link id="navio" view="/cruzeiro.xhtml">
						#{cruzeiro.navio.numero} - #{cruzeiro.navio.nome}
						<f:param name="cruzeiroId" value="#{cruzeiro.id}" />
					</s:link>
				</rich:column>
			</rich:dataTable>
      		<rich:datascroller for="cruzeiroList" maxPages="5" renderIfSinglePage="false" 
					rendered="#{not empty cruzeiroList.resultList}" />
			
	</h:form>
    
</ui:define>

</ui:composition>

